# -*- coding: utf-8 -*-

# authot: Hou chaoqun
# E-mail: 836999690@qq.com
# create: 2016/11/20
# 作用：编写一些相应的app内部调用的函数，此处给[app_TuringClass]调用
# 优点：防止views.py文件代码量过大
# 函数以__开头，如__XXXX表示只在本文件内调用，不没有提供给外部调用
# 

from app_TuringClass.models import *
from app_TuringClass.turning_class import *
from django.contrib.auth import authenticate, login, logout

def test(request, intage1, intage2):
	_sum = intage1 + intage2
	return _sum




def get_academyInfo(request):

	XMU_academyID = ['001001', '001002', '001003', '001004', '001005', '001006', '001007', '001008', '001009']
	XMU_dic = {'001001':'信息科学与技术学院', '001002':'软件学院', '001003':'物理学院', '001004':'数学学院', '001005':'航空学院', '001006':'管理学院', '001007':'体育学院', '001008':'材料学院', '001009':'机电学院'}

	academyInfo = []
	for academyID in XMU_academyID:
		academyInfo.append(XMU_academyID_Name(academyID, XMU_dic[academyID]))

	# print academyInfo[0].academyID
	# print academyInfo[0].academyName

	return academyInfo

def get_AppointmentInfo_Completed(request):
	AppointmentInfo_Completed = []
	appointments = Appointment.objects.filter(Done = 1)
	for appointment in appointments:
		if AvailableDate.objects.filter(DateID = appointment.DateID).exists():
			activityAbstract = AvailableDate.objects.get(DateID = appointment.DateID).activityAbstract
			# filter repleace get will be wrong!!
		else:
			activityAbstract = "None"
		AppointmentInfo_Completed.append(Activity_Apointment(activityAbstract, appointment))

	# print AppointmentInfo_table[0].StudentNum
	return AppointmentInfo_Completed


